package edu.sctu.zhoumengxue.day201506.day20150608;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by user12 on 2015/6/8.
 */
public class EggTimer {

    private  Timer timer = new Timer();
    private int minutes;

    public EggTimer(int minutes) {
        this.minutes = minutes;
    }

    public void start(){

        timer.schedule(new TimerTask() {
            public void run() {
                playSound();
                timer.cancel();
            }

            private void playSound() {
                System.out.println("Your egg is ready!");
            }
        },minutes*60*1000);
    }
}
